<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>伪元素选择器</title>
    <style>
        .box::before {
            content: '之前  ';
        }

        .box::after {
            content: '  之后';
        }
    </style>
</head>

<body>
    <div class="box">中间</div>
</body>

</html>